var t = getApp(), a = "plugin.mryt.api.home.get-member-list";

Page({
    data: {
        title: "",
        url: "",
        member_arr: [],
        total_num: 0,
        loading: !1,
        allLoaded: !1,
        goload: !0,
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(t) {
        "vip" == t.is_type && this.setData({
            is_type: t.is_type
        }), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.data.isLoadMore ? this.getMoreData() : wx.showToast({
            title: "没有更多了",
            icon: "none"
        });
    },
    onReachBottom: function() {
        this.getData();
    },
    onShareAppMessage: function() {},
    getData: function() {
        var e, o = this;
        "vip" == this.data.is_type ? (e = t.getNetAddresss("plugin.mryt.api.home.get-sales-member-list"), 
        e += "&page=" + this.data.page) : (e = t.getNetAddresss(a), e += "&page=" + this.data.page + "&member_type=" + this.options.type + "&level=" + this.options.level), 
        t._getNetWork({
            url: e,
            success: function(t) {
                var a = t.data;
                1 === a.result ? o.setData({
                    member_arr: a.data.member.data,
                    total_page: a.data.member.last_page,
                    title: a.data.level_name,
                    total_num: a.data.member.total ? a.data.member.total : 0
                }) : wx.showToast({
                    title: a.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getMoreData: function() {
        var e = this;
        if (this.data.page != this.data.total_page) if (this.data.page >= this.data.total_page) this.setData({
            loading: !0,
            allLoaded: !0
        }); else {
            var o = this.data.page + 1;
            this.setData({
                page: o
            });
            var s = t.getNetAddresss(a);
            s += "&page=" + this.data.page + "&type=" + this.options.type + "&level=" + this.options.level, 
            t._getNetWork({
                url: s,
                success: function(t) {
                    var a = t.data;
                    if (1 === a.result) {
                        e.setData({
                            loading: !1,
                            allLoaded: !1
                        });
                        var o = e.data.member_arr.concat(a.data.member.data);
                        e.setData({
                            member_arr: o
                        });
                    } else {
                        var s = e.data.page - 1;
                        e.setData({
                            page: s,
                            loading: !0,
                            allLoaded: !0,
                            isLoadMore: !1
                        });
                    }
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    },
    goBack: function() {
        wx.navigateBack({
            delta: 1
        });
    }
});